﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ControlAccessUser.Presenter;
using ControlAccessUser.Model;

namespace ControlAccessUser.Tests
{
    [TestClass]
    public class NoLoginTest
    {
        MockLoginView vLoginView;
        PresenterLogin pLogin;
        [TestInitialize]
        public void initial()
        {
            vLoginView = new MockLoginView();
            pLogin = new PresenterLogin(vLoginView);
            //ControlAccessUser.DataAccess.ControlAccessUserEntities.Instance.Users.Add(new User() { UserName = "ppp", UserPassword = "123456" });
            //ControlAccessUser.DataAccess.ControlAccessUserEntities.Instance.SaveChanges();
        }
        [TestCleanup]
        public void clean()
        {
            ControlAccessUser.DataAccess.ControlAccessUserEntities.Instance.LimpiarDB();
        }

        [TestMethod]
        public void VerifyIfLoginIsNotCorrectly()
        {
            vLoginView.userEnterHisData();
            pLogin.CheckLogin();
            Assert.AreEqual(vLoginView.RegisteredUser, null);
            Assert.AreEqual(Message.LoginError, vLoginView.ErrorMessageValue);
        }

        [TestMethod]
        public void LoginWithEmptyFields()
        {
            pLogin.CheckLogin();
            Assert.AreEqual(vLoginView.RegisteredUser, null);
            Assert.AreEqual(Message.NullOrEmptyFields, vLoginView.ErrorMessageValue);
        }

    }


}
